package com.xcity.game.battle.pve.employee.impl;

import com.xcity.game.battle.Battler;
import com.xcity.game.battle.pve.PlayerBattler;
import com.xcity.game.battle.pve.employee.EmployeeSkillBattleContext;
import com.xcity.game.common.GameStaticConfig;
import com.xcity.game.employee.skill.EmployeeSkill;

public class EXTRA_DAMAGE_CONTEXT extends EmployeeSkillBattleContext {

	public EXTRA_DAMAGE_CONTEXT(PlayerBattler player, EmployeeSkill ref) {
		super(player, ref);
	}

	@Override
	public boolean trigger() {
		int n = rnd.nextInt(GameStaticConfig.percentBase);
		if (n < ref.getTemplate().getInitVal(0)) {
			Battler target = player.getContext().getTarget();
			target.setHp((int) (target.getHp() - player.getAttack() * ref.getTemplate().getInitVal(1) / 100));
			return true;
		}
		return false;
	}

}
